<template>
  <div>
    <el-dialog title="分配角色" :visible.sync="showDialog">
      <el-checkbox-group v-model="roleIds">
        <el-checkbox v-for="item in roleList" :key="item.id" :label="item.id">
          {{ item.username }}
        </el-checkbox>
      </el-checkbox-group>
      <template #footer>
        <div class="dialog-footer">
          <el-button type="primary">保存</el-button>
          <el-button @click="showDialog=false">取消</el-button>
        </div>
      </template>
    </el-dialog>
  </div>
</template>

<script>
import { getEmployeeList } from '@/api/employee'
export default {
  data() {
    return {
      showDialog: false,
      roleList: [],
      roleIds: []
    }
  },
  methods: {
    async open(id) {
      const { rows } = await getEmployeeList({
        page: 1,
        size: 999
      })
      this.roleList = rows
      this.showDialog = true
    }
  }
}
</script>

<style lang="scss" scoped>

</style>
